<?php
/**
 * api模块路由
 */

use think\facade\Route;

use \app\api\middleware\OauthMiddleware;

Route::rule('/', function (Request $request) {
    return 'wrong request';
});
//验证token和权限
$oauthMiddleware = [
    OauthMiddleware::class,
];


//不验证
Route::group(function () {
    //TODO:后期需要删除
    Route::group('/Sample', function () {
        Route::get('/index', 'Sample/index');
    });
    //登录退出等
    Route::group('/Login', function () {
        Route::post('/login', 'Login/login');
    });
    //创建文档
    Route::group('/CreateSwaggerJson', function () {
        Route::get('/index', 'CreateSwaggerJson/index');
    });

    Route::group('/Token', function () {
        Route::get('/AccessToken', 'Token/getAccessToken');
    });

    Route::group('/Token', function () {
        Route::put('/AccessToken', 'Token/refreshAccessToken');
    });

    Route::group('/Upload', function () {
        Route::post('/picture', 'Upload/uploadPicture');
    });
});

//验证
Route::group(function () {
    Route::group('/Oauth', function () {
        Route::get('/index', 'Oauth/index');
    });
})->middleware($oauthMiddleware);


